<template lang="">
    <!-- <button @click="setShow">++</button>
    <template v-if="show">
        <div>
            numAddOne: {{ numAddOne }}
        </div>
        <div>
            numAddOneFun: {{ numAddOneFun() }}
        </div>
    </template>
    <button @click="num++">++++</button> -->
    <select v-model="form.telType">
        <option value = "phone">电话</option>
        <option value = "email">电子邮箱</option>
    </select>
   
    <input v-model="form.relNum" :placeholder="placeholder"/>
</template>
<script>
export default {
    data(){
        return{
            num:1,
            show:true,
            form:{
                telType:'phone',
                relNum:''
            }
        }
    },
    computed:{
        numAddOne(){
            //console.log(11111)
            return this.num+1
        },
        placeholder(){
            if(this.form.telType==='phone') return '请输入电话号码'
            return '请输入邮箱地址'
        }
        // numAddOne:{
        //     get(){
        //         return this.num+1

        //     }
        //     set(val){
        //         this.num=val
        //     }
        // }

    },
    watch:{
            num(val,oldVal){
                console.log(val,oldVal)
            },
            numAddOne(){

            },


    "form.telType": function(val) {
        this.form.relNum = ''
        }
    },
    methods: {
        numAddOneFun() {
            return this.num + 1
        },
        setShow() {
            this.show = !this.show
        }
    }
}
</script>
<style lang="">
    
</style>